package io.github.kuafucv.zero.log.helper.runtime;

public class RuntimeInfo {

    private final int SERVER_PORT;

    private static volatile RuntimeInfo instance;

    public static RuntimeInfo buildInstance() {
        if (instance == null) {
            synchronized (RuntimeInfo.class) {
                if (instance == null) {
                    instance = new RuntimeInfo();
                }
            }
        }
        return instance;
    }

    public RuntimeInfo() {
        int port = 0;
        try {
             port = RuntimeHelper.getServerPort();
        }catch (Exception ignored) {}
        SERVER_PORT = port;
    }

    public int getServerPort() {
        return SERVER_PORT;
    }
}
